package com.eaoa.uc.customer.form;

import com.eaoa.base.EABaseForm;
import com.eaoa.vo.pub.PubAddress;
import com.eaoa.vo.pub.PubCustomer;
import com.stony.core.util.CoreUtils;

public class CustomerForm extends EABaseForm{

	private String customerno;

	private String customertype;
	private String customercode;
	private String name;
	private String nameshort;
	private String telephone;
	private String faxphone;
	private String currency;
	private String bankname;
	private String bankaccount;
	private String mainregion;
	private String website;
	private String stuffnum;
	private String industry;
	private String nature;
	
	//address
	private String addressno; 
	private String addressdetail;
	private String addressprovince;
	private String addresscity;
	private String addressdistrict;
	private String postcode;
	
	public PubCustomer getVO(){
		PubCustomer po = new PubCustomer();
		
		po.setCustomerno(CoreUtils.parseLong(this.getCustomerno()));
		po.setCustomertype(CoreUtils.parseLong(this.getCustomertype()));
		po.setCustomercode(this.getCustomercode());
		po.setName(this.getName());
		po.setNameshort(this.getNameshort());
		po.setTelephone(this.getTelephone());
		po.setFaxphone(this.getFaxphone());
		po.setCurrency(this.getCurrency());
		po.setBankname(this.getBankname());
		po.setBankaccount(this.getBankaccount());
		po.setMainregion(this.getMainregion());
		po.setWebsite(this.getWebsite());
		po.setStuffnum(this.getStuffnum());
		po.setIndustry(this.getIndustry());
		po.setNature(this.getNature());
		
		//address
		PubAddress address = new PubAddress();
		address.setAddressno(CoreUtils.parseLong(this.getAddressno()));
		address.setAdname(this.getName());
		address.setAddetail(this.getAddressdetail());
		address.setProvince(this.getAddressprovince());
		address.setCity(this.getAddresscity());
		address.setDistrict(this.getAddressdistrict());
		address.setPostcode(this.getPostcode());
		po.setPubAddress(address);
		
		return po;
	}
	
	public void setVO(PubCustomer vo){
		this.setCustomerno(CoreUtils.formatString(vo.getCustomerno()));
		this.setCustomertype(CoreUtils.formatString(vo.getCustomertype()));
		this.setCustomercode(vo.getCustomercode());
		this.setName(vo.getName());
		this.setNameshort(vo.getNameshort());
		this.setTelephone(vo.getTelephone());
		this.setFaxphone(vo.getFaxphone());
		this.setCurrency(vo.getCurrency());
		this.setBankname(vo.getBankname());
		this.setBankaccount(vo.getBankaccount());
		this.setMainregion(vo.getMainregion());
		this.setWebsite(vo.getWebsite());
		this.setStuffnum(vo.getStuffnum());
		this.setIndustry(vo.getIndustry());
		this.setNature(vo.getNature());
		
		//address
		if(vo.getPubAddress()!=null){
			this.setAddressno(CoreUtils.formatString(vo.getPubAddress().getAddressno()));
			this.setAddressdetail(vo.getPubAddress().getAddetail());
			this.setAddressprovince(vo.getPubAddress().getProvince());
			this.setAddresscity(vo.getPubAddress().getCity());
			this.setAddressdistrict(vo.getPubAddress().getDistrict());
			this.setPostcode(vo.getPubAddress().getPostcode());
		}
		
	}
	
	
	public String getCustomerno() {
		return customerno;
	}
	public void setCustomerno(String customerno) {
		this.customerno = customerno;
	}
	public String getCustomertype() {
		return customertype;
	}
	public void setCustomertype(String customertype) {
		this.customertype = customertype;
	}
	public String getCustomercode() {
		return customercode;
	}
	public void setCustomercode(String customercode) {
		this.customercode = customercode;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getNameshort() {
		return nameshort;
	}
	public void setNameshort(String nameshort) {
		this.nameshort = nameshort;
	}
	public String getAddressno() {
		return addressno;
	}
	public void setAddressno(String addressno) {
		this.addressno = addressno;
	}
	public String getPostcode() {
		return postcode;
	}
	public void setPostcode(String postcode) {
		this.postcode = postcode;
	}
	public String getTelephone() {
		return telephone;
	}
	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}
	public String getFaxphone() {
		return faxphone;
	}
	public void setFaxphone(String faxphone) {
		this.faxphone = faxphone;
	}
	public String getCurrency() {
		return currency;
	}
	public void setCurrency(String currency) {
		this.currency = currency;
	}
	public String getBankname() {
		return bankname;
	}
	public void setBankname(String bankname) {
		this.bankname = bankname;
	}
	public String getBankaccount() {
		return bankaccount;
	}
	public void setBankaccount(String bankaccount) {
		this.bankaccount = bankaccount;
	}
	public String getMainregion() {
		return mainregion;
	}
	public void setMainregion(String mainregion) {
		this.mainregion = mainregion;
	}
	public String getWebsite() {
		return website;
	}
	public void setWebsite(String website) {
		this.website = website;
	}
	public String getStuffnum() {
		return stuffnum;
	}
	public void setStuffnum(String stuffnum) {
		this.stuffnum = stuffnum;
	}
	public String getIndustry() {
		return industry;
	}
	public void setIndustry(String industry) {
		this.industry = industry;
	}
	public String getNature() {
		return nature;
	}
	public void setNature(String nature) {
		this.nature = nature;
	}

	public String getAddressdetail() {
		return addressdetail;
	}

	public void setAddressdetail(String addressdetail) {
		this.addressdetail = addressdetail;
	}

	public String getAddressprovince() {
		return addressprovince;
	}

	public void setAddressprovince(String addressprovince) {
		this.addressprovince = addressprovince;
	}

	public String getAddresscity() {
		return addresscity;
	}

	public void setAddresscity(String addresscity) {
		this.addresscity = addresscity;
	}

	public String getAddressdistrict() {
		return addressdistrict;
	}

	public void setAddressdistrict(String addressdistrict) {
		this.addressdistrict = addressdistrict;
	}

}
